package com.zlf.sb.demo.result;

import lombok.Data;

/***
 *@title BaseResult
 *@description <TODO description class purpose>
 *@author wgc_j
 *@version 1.0.0
 *@create 2025-02-13 14:28
 **/
@Data
public class BaseResult<T> {
    private int code;
    private String message;
    private T data;

    public static BaseResult<Long> ofSuccess(long id) {
        BaseResult<Long> result = new BaseResult<>();
        result.setCode(200);
        result.setMessage("success");
        result.setData(id);
        return result;
    }

    public static BaseResult<String> ofFail(String message) {
        BaseResult<String> result = new BaseResult<>();
        result.setCode(500);
        result.setMessage(message);
        result.setData(null);
        return result;
    }
}
